package com.slz3.business.module.goodsManagement.gooBaseGoodsAttribute.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooBaseGoodsAttribute.domain.GooBaseGoodsAttribute;
import com.slz3.business.module.goodsManagement.gooBaseGoodsAttribute.domain.GooBaseGoodsAttributeFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooBaseGoodsAttributeTransactionalServiceImpl implements GooBaseGoodsAttributeTransactionalService {

    @Override
    public GooBaseGoodsAttribute modify(GooBaseGoodsAttribute gooBaseGoodsAttributeNew) {
        Repositorys.gooBaseGoodsAttribute.test();
        Repositorys.gooBaseGoodsAttribute.save(GooBaseGoodsAttributeFactory.initBaseFields());
        System.err.println(1/0);
        gooBaseGoodsAttributeNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooBaseGoodsAttribute.saveAndFlush(gooBaseGoodsAttributeNew);
    }

    @Override
    public List<GooBaseGoodsAttribute> batchModify(List<GooBaseGoodsAttribute> gooBaseGoodsAttributeList) {
        return Repositorys.gooBaseGoodsAttribute.saveAll(gooBaseGoodsAttributeList);
    }
}
